package com.wksc.authority.service;

import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wksc.authority.domain.Func;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @author Zero
 */
public class TestJson {
    public static void main(String[] args) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
//        File file = new File("func.json");
        InputStream inputStream = TestJson.class.getResourceAsStream("/func.json");
//        System.out.println("文件大小：" + file.length());
//        InputStream inputStream = new FileInputStream(file);
//        byte[] bytes = new byte[1024 * 1024];
//        inputStream.read(bytes);

        JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, Func.class);

        List<Func> funcList = mapper.readValue(inputStream, javaType);

        System.out.println(funcList);

    }
}
